<template>
  <div class="report-templates">
    <div class="templates-header">
      <Row :gutter="16">
        <Col :span="8">
          <Input
            v-model:value="searchForm.keyword"
            placeholder="搜索报表模板名称"
            allow-clear
            @change="handleSearch"
          />
        </Col>
        <Col :span="4">
          <Select
            v-model:value="searchForm.status"
            placeholder="状态"
            allow-clear
            @change="handleSearch"
          >
            <SelectOption value="ACTIVE">激活</SelectOption>
            <SelectOption value="INACTIVE">非激活</SelectOption>
            <SelectOption value="DRAFT">草稿</SelectOption>
          </Select>
        </Col>
        <Col :span="8">
          <Space>
            <Button type="primary" @click="handleSearch">搜索</Button>
            <Button @click="handleReset">重置</Button>
            <Button type="primary" @click="openTemplateForm('create')">
              新增模板
            </Button>
          </Space>
        </Col>
      </Row>
    </div>

    <div class="templates-content">
      <Card title="报表模板列表" :bordered="false">
        <div class="placeholder-content">
          <IconifyIcon icon="mdi:chart-box" size="48" />
          <p>报表模板管理功能开发中...</p>
        </div>
      </Card>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from 'vue';
import {
  Button,
  Card,
  Col,
  Input,
  Row,
  Select,
  SelectOption,
  Space,
} from 'ant-design-vue';
import { IconifyIcon } from '@vben/icons';

const searchForm = reactive({
  keyword: '',
  status: '',
});

const handleSearch = () => {
  console.warn('搜索报表模板:', searchForm);
};

const handleReset = () => {
  Object.assign(searchForm, {
    keyword: '',
    status: '',
  });
  handleSearch();
};

const openTemplateForm = (type: 'create' | 'edit') => {
  console.warn('打开模板表单:', type);
};
</script>

<style scoped>
.report-templates {
  padding: 20px;
}

.templates-header {
  margin-bottom: 24px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
}

.templates-content {
  margin-bottom: 24px;
}

.placeholder-content {
  padding: 60px 20px;
  color: #999;
  text-align: center;
}

.placeholder-content p {
  margin-top: 16px;
  font-size: 16px;
}
</style>
